# -*- coding: utf-8 -*-
"""Controlador de Colas y Pilas"""

from collections import deque
 
class Pila:
    def __init__(self):
        self.__stack = []
        
    def top(self):
        return self.__stack[-1]
    
    def pop(self):
        self.__stack.pop()
        
    def push(self, value):
        self.__stack.append(value)
        
    def empty(self):
        return not bool(self.__stack)

    def size(self):
        return len(self.__stack)
        
class Cola:
    def __init__(self):
        self.__queue = deque()
    
    def enqueue(self, value):
        self.__queue.append(value)
        
    def dequeue(self):
        self.__queue.popleft()
    
    def top(self):
        return self.__queue[0]
    
    def empty(self):
        return not bool(self.__queue)
    
    def __iter__(self):
        return iter(self.__queue)

